<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>VUE第一天 v-for</title>
</head>
<body>
  <div id="app"> 
    <table border="1">
      <tr>
        <td>名称</td>
        <td>单价</td>
        <td>数量</td>
        <td>小计</td>
      </tr>
      <tr v-for="item in cart">
        <td>{{item.name}}</td>
        <td>{{item.price}}</td>
        <td>{{item.num}}</td>
        <td>888元</td>
      </tr>
      <tr>
        <td colspan="2">总价</td>
        <td>22件</td>
        <td>9999元</td>
      </tr>
    </table>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        cart: [
          {
            name: 'iphone 12',
            num: 5,
            price: 6999
          },
          {
            name: 'huawei p40',
            num: 8,
            price: 4999
          }
        ]
      },
    });
  </script>
</body>
</html>